#include <vector>
#include <iostream>
using namespace std;

void bubble_sort(vector<int> &v)
{
  int t=0;
  for (int j=0; j < v.size()-1; j++ )
  {
    for (int i=j+1; i < v.size(); i++)
    { 
      if (v[j] > v[i])
      {
        t=v[i];
        v[i]=v[j];
        v[j]=t;
      }
    }
  }  
}

void test_sort(vector <int> v)
{
  int flag=1;
  for(int i=1; i < v.size(); i++)
  {
    if (v[i-1]>=v[i]) flag=0;
  }
  if (flag==1) 
  {
    cout << "Sort +" << endl;
  }
  else 
  {
    cout << "Sort -" << endl;
  }
}

void quick_sort(vector <int> &a, int left, int right) 
{
  int i = left; 
  int j = right;
  int temp;
  int median = a[(left + right)/2];

  while (i <= j) 
  {
    while (a[i] < median)  i++;
    while (a[j] > median)  j--;
    if (i <= j) 
    {
      temp = a[i];
      a[i] = a[j];
      a[j] = temp;
      i++; j--;
    }
  }
  
  if (left < j)
      quick_sort(a, left, j);
  if (i < right)
      quick_sort(a, i, right);
}

int main ()
{
  vector <int> v;
  vector <int> numbers;
  int j;

  while (1) 
  {
    cout << "number" << endl;
    cin >> j;
    if (0==j) break;
    v.push_back(j);
  }
  
  test_sort(v);

  for (int i=0; i < v.size(); i++)
  {
    int a = -1;
    for (int q=0; q < numbers.size(); q++)
    {
      if (v[i]==numbers[q]) a = q;
    }
    if(a==-1) numbers.push_back(v[i]);
  }

  quick_sort(numbers, 0, numbers.size()-1);
  //bubble_sort(numbers);

  for (int j=0; j < numbers.size(); j++)
  {
    cout << numbers[j] << " ";
  }
  cout << endl;
  test_sort(numbers);

return 0;
}
